<template>
  <iframe :onload="onloadCode" style="width:100%;height:100%;border:1px solid #fff;background: #000;"></iframe>
</template>
<script>
export default {
  props: {
    src: '',
  },
  data() {
    return {
      onloadCode: ''
    }
  },
  methods:{
    play(index) {
      let videoContext = uni.createVideoContext('videoId', this)
	  console.log('播放',videoContext)
      videoContext.requestFullScreen()
    },
    //退出全屏时暂停
    fullscreenchange(e) {
      if (!e.detail.fullScreen) {
        uni.createVideoContext('videoId', this).pause();
      }
    },
  },
  created() {
    console.log(this.src)
    this.onloadCode =
        `this.contentWindow.document.body.innerHTML = '<video style="width: 100%;height: 100%" :autoplay="true" controls :direction="90"  @play="play"  @fullscreenchange="fullscreenchange"  id="videoId"  src="${this.src}"></video>';`
  },
}
</script>
<style lang="scss">
</style>